<?php

namespace App\Http\Controllers\home;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Http\Controllers\admin\CateController;
use DB;
class HomeController extends Controller
{
<<<<<<< HEAD
    /**
    *计算两个时间戳之间的时间差，将相差的天，时，分，秒以数组形式返回
    */
    public static function timediff($begin_time,$end_time) 
    { 
        if($begin_time < $end_time){ 
         $starttime = $begin_time; 
         $endtime = $end_time; 
        } 
        else{ 
         $starttime = $end_time; 
         $endtime = $begin_time; 
        } 
        $timediff = $endtime-$starttime; 
        $days = intval($timediff/86400); 
        $remain = $timediff%86400; 
        $hours = intval($remain/3600); 
        $remain = $remain%3600; 
        $mins = intval($remain/60); 
        $secs = $remain%60; 
        $res = array("day" => $days,"hour" => $hours,"min" => $mins,"sec" => $secs); 
        return $res; 
    }
=======
>>>>>>> 31e42f2d3415b82d4888522298db4e7de5f9c8aa
    public function getIndex()
    {
    	//判断用户是否登录
    	//获取所有分类
    	$data = CateController::getCatePid(0);
    	//获取轮播图照片
    	$data1 = DB :: table('shop_carousel') ->select('cpic', 'gid') ->get(); 
    	//dd($data1);
        return view('home.home.index', ['data' => $data, 'data1' => $data1]);
    }
}
